package com.twu.biblioteca.menu;

import com.twu.biblioteca.books.BookCollection;
import com.twu.biblioteca.users.UserSession;

import java.util.Scanner;

public class CheckOutBookOption implements OptionChoosenByUser {

    @Override
    public void execute() {
        if (UserSession.isUserLoggedIn()) {
            System.out.println("Enter the ISBN number: ");
            String ISBN = new Scanner(System.in).nextLine();
            BookCollection bookCollection = BookCollection.getInstance();
            if (bookCollection.checkOut(ISBN) != null) {
                System.out.println("Thank you Enjoy the Book");
            } else {
                System.out.println("Sorry we dont have that book yet");
            }
        } else {
            System.out.println("You are not allowed to check out a book");
        }
    }
}
